import { Action } from "@ngrx/store";
import {
  ISelectSymbolResponse,
  ISelectSymbolRequest,
  ISelectOrderResponse,
  ISelectOrderRequest,
  IAddOrderRequest,
  IAddOrderResponse,
  IDelOrderRequest,
  IDelOrderResponse,
  ISelectCoinListsRequest,
  ISelectCoinListsResponse,
  ISelectActiveRequest,
  ISelectActiveResponse,
  ISelectHistoryRequest,
  ISelectHistoryResponse
} from "../models/trade";
export enum TradeActionTypes {
  SelectSymbol = "[Trade] SelectSymbol",
  SelectSymbolSuccess = "[Trade] Select Symbol Success",
  SelectSymbolError = "[Trade] Select Symbol Error",

  AddOrder = "[Trade] Add Order",
  AddOrderSuccess = "[Trade] Add Order Success",
  AddOrderError = "[Trade] Add Order Error",

  SelectOrder = "[Trade] Select Order",
  SelectOrderSuccess = "[Trade] Select Order Success",
  SelectOrderError = "[Trade] Select Order Error",

  DelOrder = "[Trade] Del Order",
  DelOrderSuccess = "[Trade] Del Order Success",
  DelOrderError = "[Trade] Del Order Error",

  // here is repeat with selectAssets need to remove it
  SelectCoinLists = "[Trade] SelectCoinLists",
  SelectCoinListsSuccess = "[Trade] Del SelectCoinLists Success",
  SelectCoinListsError = "[Trade] Del SelectCoinLists Error",

  SelectActive = "[Trade] SelectActive",
  SelectActiveSuccess = "[Trade] SelectActiveSuccess",
  SelectActiveError = "[Trade] SelectActiveError",

  SelectHistory = "[Trade] SelectHistory",
  SelectHistorySuccess = "[Trade] SelectHistorySuccess",
  SelectHistoryError = "[Trade] SelectHistoryError"
}

export class SelectSymbol implements Action {
  readonly type = TradeActionTypes.SelectSymbol;
  constructor(public payload: { req: ISelectSymbolRequest }) {}
}

export class SelectSymbolSuccess implements Action {
  readonly type = TradeActionTypes.SelectSymbolSuccess;
  constructor(public payload: { res: ISelectSymbolResponse }) {}
}

export class SelectSymbolError implements Action {
  readonly type = TradeActionTypes.SelectSymbolError;
  constructor(public payload: { error: any }) {}
}

export class AddOrder implements Action {
  readonly type = TradeActionTypes.AddOrder;
  constructor(public payload: { req: IAddOrderRequest }) {}
}

export class AddOrderSuccess implements Action {
  readonly type = TradeActionTypes.AddOrderSuccess;
  constructor(public payload: { res: IAddOrderResponse }) {}
}

export class AddOrderError implements Action {
  readonly type = TradeActionTypes.AddOrderError;
  constructor(public payload: { error: any }) {}
}

export class SelectOrder implements Action {
  readonly type = TradeActionTypes.SelectOrder;
  constructor(public payload: { req: ISelectOrderRequest }) {}
}

export class SelectOrderSuccess implements Action {
  readonly type = TradeActionTypes.SelectOrderSuccess;
  constructor(public payload: { res: ISelectOrderResponse }) {}
}

export class SelectOrderError implements Action {
  readonly type = TradeActionTypes.SelectOrderError;
  constructor(public payload: { error: any }) {}
}

export class SelectActive implements Action {
  readonly type = TradeActionTypes.SelectActive;
  constructor(public payload: { req: ISelectActiveRequest }) {}
}

export class SelectActiveSuccess implements Action {
  readonly type = TradeActionTypes.SelectActiveSuccess;
  constructor(public payload: { res: ISelectActiveResponse }) {}
}

export class SelectActiveError implements Action {
  readonly type = TradeActionTypes.SelectActiveError;
  constructor(public payload: { error: any }) {}
}

export class SelectHistory implements Action {
  readonly type = TradeActionTypes.SelectHistory;
  constructor(public payload: { req: ISelectHistoryRequest }) {}
}

export class SelectHistorySuccess implements Action {
  readonly type = TradeActionTypes.SelectHistorySuccess;
  constructor(public payload: { res: ISelectHistoryResponse }) {}
}

export class SelectHistoryError implements Action {
  readonly type = TradeActionTypes.SelectHistoryError;
  constructor(public payload: { error: any }) {}
}

export class DelOrder implements Action {
  readonly type = TradeActionTypes.DelOrder;
  constructor(public payload: { req: IDelOrderRequest }) {}
}

export class DelOrderSuccess implements Action {
  readonly type = TradeActionTypes.DelOrderSuccess;
  constructor(public payload: { res: IDelOrderResponse }) {}
}

export class DelOrderError implements Action {
  readonly type = TradeActionTypes.DelOrderError;
  constructor(public payload: { error: any }) {}
}

export class SelectCoinLists implements Action {
  readonly type = TradeActionTypes.SelectCoinLists;
  constructor(public payload: { req: ISelectCoinListsRequest }) {}
}

export class SelectCoinListsSuccess implements Action {
  readonly type = TradeActionTypes.SelectCoinListsSuccess;
  constructor(public payload: { res: ISelectCoinListsResponse }) {}
}

export class SelectCoinListsError implements Action {
  readonly type = TradeActionTypes.SelectCoinListsError;
  constructor(public payload: { error: any }) {}
}

export type TradeActionsUnion =
  | SelectHistoryError
  | SelectHistorySuccess
  | SelectHistory
  | SelectActiveError
  | SelectActiveSuccess
  | SelectActive
  | SelectCoinListsError
  | SelectCoinListsSuccess
  | SelectCoinLists
  | DelOrderError
  | DelOrderSuccess
  | DelOrder
  | SelectOrderError
  | SelectOrderSuccess
  | SelectOrder
  | AddOrderError
  | AddOrderSuccess
  | AddOrder
  | SelectSymbol
  | SelectSymbolSuccess
  | SelectSymbolError;
